﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using NETCORE.EF.Model;

namespace NETCORE.EF.WebAPI.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class TestController : ControllerBase
    {

        private readonly DataBase db;

        public TestController(DataBase context)
        {
            this.db = context;
        }

        [HttpGet]
        [Route("Get1")]
        public IActionResult Get1()
        {
            TB_User model = new TB_User();
            model.id = 12;
            model.name = "张三";
            model.isdelete = true;
            model.gender = "男";
            model.birthday = DateTime.Parse("1985-04-15");

            var tt = db.Set<TB_User>().Where(c => true).ToList();
            
            db.Set<TB_User>().Add(model);
            db.SaveChanges();

            return new JsonResult(new { aaa = "111", bbb = "222" });
        }
    }
}
